"""

项目接口


"""




#1.导包
from flask import Flask
import time
#基础模块
from  flask import request,jsonify

#导入用户模块

#建立flask实例
app = Flask(__name__)

# 全局配置跨域
from flask_cors import CORS
cors = CORS(app)


#解决中文乱码
from config import Config
app.config.from_object(Config)




#注册蓝图
from lianxi.hoke import user
app.register_blueprint(user,url_prefix = '/add')



# #视图
# @app.route('/',methods=['GET','POST','PUT','DELETE'])
# async  def hello_word():

#     #get通过url传参
#     data = request.args.get('id')

#     #post通过form传参
#     data = request.form.get('id')

#     print(data)
#     # return  'hello world'
#     return ({'code':200,'mes':'你好'})

# #耗时任务
# async def get_data():

#     time.sleep(5)



# #性能接口
# @app.route('/data/')
# async def mydata():
#     print('开始执行')
#     # time.sleep(5)
#     await get_data() #调用耗时任务
#     print('执行结束')
#     return {'mes':"执行结束"}




#调用实例对象

if __name__ =='__main__':

    app.run(debug=True,host='0.0.0.0',port = 5000)  #开启调试模式  host开启外部访问别人可以访问










